home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2011 April / ME_2011_04.iso / [Video-Tutorial] / splash.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2008-10-31  |  15.2 KB  |  548 lines

  1. function output(arg)
  2. {
  3.    status_op.text = arg;
  4. }
  5. function loadClip(_file, _mc)
  6. {
  7.    var _loc1_ = new MovieClipLoader();
  8.    _loc1_.onLoadStart = function(targetMC)
  9.    {
  10.       targetMC._alpha = 0;
  11.    };
  12.    _loc1_.onLoadProgress = function(targetMC, loadedBytes, totalBytes)
  13.    {
  14.    };
  15.    _loc1_.onLoadComplete = function(targetMC)
  16.    {
  17.    };
  18.    _loc1_.onLoadInit = function(targetMC)
  19.    {
  20.       var _loc3_ = System.capabilities.screenResolutionX;
  21.       var _loc2_ = System.capabilities.screenResolutionY;
  22.       mdm.Forms.SplashForm.x = Math.round(_loc3_ / 2 - (targetMC._width + 40) / 2);
  23.       mdm.Forms.SplashForm.y = Math.round(_loc2_ / 2 - (targetMC._height + 40) / 2);
  24.       mdm.Forms.SplashForm.width = targetMC._width + 40;
  25.       mdm.Forms.SplashForm.height = targetMC._height + 40;
  26.       targetMC._x = 20;
  27.       targetMC._y = 20;
  28.       var _loc4_ = new flash.filters.DropShadowFilter(2,65,0,0.3,10,10,2,5);
  29.       targetMC.filters = [_loc4_];
  30.       targetMC.init();
  31.       targetMC.tween(["_alpha"],100,1,"easeOutQuart");
  32.    };
  33.    _loc1_.onLoadError = function(targetMC, errorCode)
  34.    {
  35.    };
  36.    _loc1_.loadClip(_file,_mc);
  37. }
  38. function renderSplash()
  39. {
  40.    var _loc2_ = settings.firstChild.childNodes[0];
  41.    while(_loc2_ != null)
  42.    {
  43.       _root[_loc2_.nodeName] = _loc2_.firstChild.nodeValue;
  44.       _loc2_ = _loc2_.nextSibling;
  45.    }
  46.    if(splash_show_status == "true")
  47.    {
  48.       status_op._visible = true;
  49.    }
  50.    test_op.text = "renderSpash: " + appdir + " / " + folder + " / " + splash_image;
  51.    _root.createEmptyMovieClip("splash_mc",1);
  52.    loadClip(appdir + folder + splash_image,splash_mc);
  53. }
  54. function loadSettings()
  55. {
  56.    status_op.text = "Loading..";
  57.    settings = new XML();
  58.    settings.ignoreWhite = true;
  59.    settings.onLoad = renderSplash;
  60.    settings.load(appdir + folder + "config/settings.xml",false);
  61. }
  62. Stage.align = "LT";
  63. Stage.scaleMode = "noScale";
  64. if(_global.$tweenManager == undefined)
  65. {
  66.    _global.$tweenManager = new zigo.tweenManager();
  67. }
  68. else
  69. {
  70.    _global.$tweenManager.cleanUp();
  71.    _global.$tweenManager.init();
  72. }
  73. com.robertpenner.easing.Back;
  74. com.robertpenner.easing.Bounce;
  75. com.robertpenner.easing.Circ;
  76. com.robertpenner.easing.Cubic;
  77. com.robertpenner.easing.Elastic;
  78. com.robertpenner.easing.Expo;
  79. com.robertpenner.easing.Linear;
  80. com.robertpenner.easing.Quad;
  81. com.robertpenner.easing.Quart;
  82. com.robertpenner.easing.Quint;
  83. com.robertpenner.easing.Sine;
  84. var Mp = MovieClip.prototype;
  85. Mp.addListener = function()
  86. {
  87.    if(!this._listeners)
  88.    {
  89.       AsBroadcaster.initialize(this);
  90.    }
  91.    this.addListener.apply(this,arguments);
  92. };
  93. ASSetPropFlags(Mp,"addListener",1,0);
  94. Mp.tween = function(props, pEnd, seconds, animType, delay, callback, extra1, extra2)
  95. {
  96.    if(_global.$tweenManager.isTweenLocked(this))
  97.    {
  98.       return undefined;
  99.    }
  100.    if(arguments.length < 2)
  101.    {
  102.       return undefined;
  103.    }
  104.    if(typeof props == "string")
  105.    {
  106.       if(props.indexOf(",") > -1)
  107.       {
  108.          props = props.split(" ").join("").split(",");
  109.       }
  110.       else
  111.       {
  112.          props = [props];
  113.       }
  114.    }
  115.    if(!(pEnd instanceof Array))
  116.    {
  117.       pEnd = [pEnd];
  118.       while(pEnd.length < props.length)
  119.       {
  120.          pEnd.push(pEnd[0]);
  121.       }
  122.    }
  123.    if(seconds == undefined)
  124.    {
  125.       seconds = 2;
  126.    }
  127.    else if(seconds < 0.01)
  128.    {
  129.       seconds = 0;
  130.    }
  131.    if(delay < 0.01 || delay == undefined)
  132.    {
  133.       delay = 0;
  134.    }
  135.    switch(typeof animType)
  136.    {
  137.       case "string":
  138.          animType = animType.toLowerCase();
  139.          if(animType == "linear")
  140.          {
  141.             var eqf = com.robertpenner.easing.Linear.easeNone;
  142.          }
  143.          else if(animType.indexOf("easeoutin") == 0)
  144.          {
  145.             var t = animType.substr(9);
  146.             t = t.charAt(0).toUpperCase() + t.substr(1);
  147.             var eqf = com.robertpenner.easing[t].easeOutIn;
  148.          }
  149.          else if(animType.indexOf("easeinout") == 0)
  150.          {
  151.             var t = animType.substr(9);
  152.             t = t.charAt(0).toUpperCase() + t.substr(1);
  153.             var eqf = com.robertpenner.easing[t].easeInOut;
  154.          }
  155.          else if(animType.indexOf("easein") == 0)
  156.          {
  157.             var t = animType.substr(6);
  158.             t = t.charAt(0).toUpperCase() + t.substr(1);
  159.             var eqf = com.robertpenner.easing[t].easeIn;
  160.          }
  161.          else if(animType.indexOf("easeout") == 0)
  162.          {
  163.             var t = animType.substr(7);
  164.             t = t.charAt(0).toUpperCase() + t.substr(1);
  165.             var eqf = com.robertpenner.easing[t].easeOut;
  166.          }
  167.          if(eqf == undefined)
  168.          {
  169.             var eqf = com.robertpenner.easing.Expo.easeOut;
  170.          }
  171.          break;
  172.       case "function":
  173.          var eqf = animType;
  174.          break;
  175.       case "object":
  176.          if(animType.ease != undefined && animType.pts != undefined)
  177.          {
  178.             var eqf = animType.ease;
  179.             extra1 = animType.pts;
  180.          }
  181.          else
  182.          {
  183.             var eqf = com.robertpenner.easing.Expo.easeOut;
  184.          }
  185.          break;
  186.       default:
  187.          var eqf = com.robertpenner.easing.Expo.easeOut;
  188.    }
  189.    switch(typeof callback)
  190.    {
  191.       case "function":
  192.          callback = {func:callback,scope:this._parent};
  193.          break;
  194.       case "string":
  195.          var ilp;
  196.          var funcp;
  197.          var scope;
  198.          var args;
  199.          var a;
  200.          ilp = callback.indexOf("(");
  201.          funcp = callback.slice(0,ilp);
  202.          scope = eval(funcp.slice(0,funcp.lastIndexOf(".")));
  203.          func = eval(funcp);
  204.          args = callback.slice(ilp + 1,callback.lastIndexOf(")")).split(",");
  205.          var i = 0;
  206.          while(i < args.length)
  207.          {
  208.             a = eval(args[i]);
  209.             if(a != undefined)
  210.             {
  211.                args[i] = a;
  212.             }
  213.             i++;
  214.          }
  215.          callback = {func:func,scope:scope,args:args};
  216.    }
  217.    if(_global.$tweenManager.autoStop)
  218.    {
  219.       _global.$tweenManager.removeTween(this);
  220.    }
  221.    if(delay > 0)
  222.    {
  223.       _global.$tweenManager.addTweenWithDelay(delay,this,props,pEnd,seconds,eqf,callback,extra1,extra2);
  224.    }
  225.    else
  226.    {
  227.       _global.$tweenManager.addTween(this,props,pEnd,seconds,eqf,callback,extra1,extra2);
  228.    }
  229. };
  230. Mp.stopTween = function(props)
  231. {
  232.    if(typeof props == "string")
  233.    {
  234.       if(props.indexOf(",") > -1)
  235.       {
  236.          props = props.split(" ").join("").split(",");
  237.       }
  238.       else
  239.       {
  240.          props = [props];
  241.       }
  242.    }
  243.    _global.$tweenManager.removeTween(this,props);
  244. };
  245. Mp.isTweening = function(prop)
  246. {
  247.    return _global.$tweenManager.isTweening(this,prop);
  248. };
  249. Mp.getTweens = function()
  250. {
  251.    return _global.$tweenManager.getTweens(this);
  252. };
  253. Mp.lockTween = function()
  254. {
  255.    _global.$tweenManager.lockTween(this,true);
  256. };
  257. Mp.unlockTween = function()
  258. {
  259.    _global.$tweenManager.lockTween(this,false);
  260. };
  261. Mp.isTweenLocked = function()
  262. {
  263.    return _global.$tweenManager.isTweenLocked(this);
  264. };
  265. Mp.isTweenPaused = function(prop)
  266. {
  267.    return _global.$tweenManager.isTweenPaused(this,prop);
  268. };
  269. Mp.pauseTween = function(props)
  270. {
  271.    var _loc4_ = undefined;
  272.    if(props != undefined)
  273.    {
  274.       if(typeof props == "string")
  275.       {
  276.          if(props.indexOf(",") > -1)
  277.          {
  278.             props = props.split(" ").join("").split(",");
  279.          }
  280.          else
  281.          {
  282.             props = [props];
  283.          }
  284.       }
  285.       _loc4_ = {};
  286.       for(var _loc5_ in props)
  287.       {
  288.          _loc4_[props[_loc5_]] = true;
  289.       }
  290.    }
  291.    _global.$tweenManager.pauseTween(this,_loc4_);
  292. };
  293. Mp.unpauseTween = function(props)
  294. {
  295.    var _loc4_ = undefined;
  296.    if(props != undefined)
  297.    {
  298.       if(typeof props == "string")
  299.       {
  300.          if(props.indexOf(",") > -1)
  301.          {
  302.             props = props.split(" ").join("").split(",");
  303.          }
  304.          else
  305.          {
  306.             props = [props];
  307.          }
  308.       }
  309.       _loc4_ = {};
  310.       for(var _loc5_ in props)
  311.       {
  312.          _loc4_[props[_loc5_]] = true;
  313.       }
  314.    }
  315.    _global.$tweenManager.unpauseTween(this,_loc4_);
  316. };
  317. Mp.pauseAllTweens = function()
  318. {
  319.    _global.$tweenManager.pauseTween();
  320. };
  321. Mp.unpauseAllTweens = function()
  322. {
  323.    _global.$tweenManager.unpauseTween();
  324. };
  325. Mp.stopAllTweens = function()
  326. {
  327.    _global.$tweenManager.stopAll();
  328. };
  329. Mp.ffTween = function(props)
  330. {
  331.    var _loc4_ = undefined;
  332.    if(props != undefined)
  333.    {
  334.       if(typeof props == "string")
  335.       {
  336.          if(props.indexOf(",") > -1)
  337.          {
  338.             props = props.split(" ").join("").split(",");
  339.          }
  340.          else
  341.          {
  342.             props = [props];
  343.          }
  344.       }
  345.       _loc4_ = {};
  346.       for(var _loc5_ in props)
  347.       {
  348.          _loc4_[props[_loc5_]] = true;
  349.       }
  350.    }
  351.    _global.$tweenManager.ffTween(this,_loc4_);
  352. };
  353. Mp.rewTween = function(props)
  354. {
  355.    var _loc4_ = undefined;
  356.    if(props != undefined)
  357.    {
  358.       if(typeof props == "string")
  359.       {
  360.          if(props.indexOf(",") > -1)
  361.          {
  362.             props = props.split(" ").join("").split(",");
  363.          }
  364.          else
  365.          {
  366.             props = [props];
  367.          }
  368.       }
  369.       _loc4_ = {};
  370.       for(var _loc5_ in props)
  371.       {
  372.          _loc4_[props[_loc5_]] = true;
  373.       }
  374.    }
  375.    _global.$tweenManager.rewTween(this,_loc4_);
  376. };
  377. Mp.alphaTo = function(destAlpha, seconds, animType, delay, callback, extra1, extra2)
  378. {
  379.    this.tween(["_alpha"],[destAlpha],seconds,animType,delay,callback,extra1,extra2);
  380. };
  381. Mp.scaleTo = function(destScale, seconds, animType, delay, callback, extra1, extra2)
  382. {
  383.    this.tween(["_xscale","_yscale"],[destScale,destScale],seconds,animType,delay,callback,extra1,extra2);
  384. };
  385. Mp.sizeTo = function(destSize, seconds, animType, delay, callback, extra1, extra2)
  386. {
  387.    this.tween(["_width","_height"],[destSize,destSize],seconds,animType,delay,callback,extra1,extra2);
  388. };
  389. Mp.slideTo = function(destX, destY, seconds, animType, delay, callback, extra1, extra2)
  390. {
  391.    this.tween(["_x","_y"],[destX,destY],seconds,animType,delay,callback,extra1,extra2);
  392. };
  393. Mp.rotateTo = function(destRotation, seconds, animType, delay, callback, extra1, extra2)
  394. {
  395.    this.tween(["_rotation"],[destRotation],seconds,animType,delay,callback,extra1,extra2);
  396. };
  397. _global.getColorTransObj = function(type, amt, rgb)
  398. {
  399.    switch(type)
  400.    {
  401.       case "brightness":
  402.          var _loc4_ = 100 - Math.abs(amt);
  403.          var _loc6_ = 0;
  404.          if(amt > 0)
  405.          {
  406.             _loc6_ = 256 * (amt / 100);
  407.          }
  408.          return {ra:_loc4_,rb:_loc6_,ga:_loc4_,gb:_loc6_,ba:_loc4_,bb:_loc6_};
  409.       case "brightOffset":
  410.          _loc6_ = 256 * (amt / 100);
  411.          return {ra:100,rb:_loc6_,ga:100,gb:_loc6_,ba:100,bb:_loc6_};
  412.       case "contrast":
  413.          var _loc2_ = {};
  414.          var _loc0_ = null;
  415.          _loc2_.ba = _loc0_ = amt;
  416.          _loc2_.ga = _loc0_;
  417.          _loc2_.ra = _loc0_;
  418.          _loc2_.bb = _loc0_ = 128 - 1.28 * amt;
  419.          _loc2_.gb = _loc0_;
  420.          _loc2_.rb = _loc0_;
  421.          return _loc2_;
  422.       case "invertColor":
  423.          _loc2_ = {};
  424.          _loc2_.ba = _loc0_ = 100 - 2 * amt;
  425.          _loc2_.ga = _loc0_;
  426.          _loc2_.ra = _loc0_;
  427.          _loc2_.bb = _loc0_ = amt * 2.55;
  428.          _loc2_.gb = _loc0_;
  429.          _loc2_.rb = _loc0_;
  430.          return _loc2_;
  431.       case "tint":
  432.          if(rgb == undefined || rgb == null)
  433.          {
  434.             break;
  435.          }
  436.          var _loc8_ = rgb >> 16;
  437.          var _loc9_ = rgb >> 8 & 0xFF;
  438.          var _loc7_ = rgb & 0xFF;
  439.          var _loc5_ = amt / 100;
  440.          _loc2_ = {rb:_loc8_ * _loc5_,gb:_loc9_ * _loc5_,bb:_loc7_ * _loc5_};
  441.          _loc2_.ba = _loc0_ = 100 - amt;
  442.          _loc2_.ga = _loc0_;
  443.          _loc2_.ra = _loc0_;
  444.          return _loc2_;
  445.    }
  446.    return {rb:0,ra:100,gb:0,ga:100,bb:0,ba:100};
  447. };
  448. Mp.brightnessTo = function(bright, seconds, animType, delay, callback, extra1, extra2)
  449. {
  450.    this.tween(["_ct_"],[getColorTransObj("brightness",bright)],seconds,animType,delay,callback,extra1,extra2);
  451. };
  452. Mp.brightOffsetTo = function(percent, seconds, animType, delay, callback, extra1, extra2)
  453. {
  454.    this.tween(["_ct_"],[getColorTransObj("brightOffset",percent)],seconds,animType,delay,callback,extra1,extra2);
  455. };
  456. Mp.contrastTo = function(percent, seconds, animType, delay, callback, extra1, extra2)
  457. {
  458.    this.tween(["_ct_"],[getColorTransObj("contrast",percent)],seconds,animType,delay,callback,extra1,extra2);
  459. };
  460. Mp.colorTo = function(rgb, seconds, animType, delay, callback, extra1, extra2)
  461. {
  462.    this.tween(["_ct_"],[getColorTransObj("tint",100,rgb)],seconds,animType,delay,callback,extra1,extra2);
  463. };
  464. Mp.colorTransformTo = function(ra, rb, ga, gb, ba, bb, aa, ab, seconds, animType, delay, callback, extra1, extra2)
  465. {
  466.    var _loc2_ = {ra:ra,rb:rb,ga:ga,gb:gb,ba:ba,bb:bb,aa:aa,ab:ab};
  467.    this.tween(["_ct_"],[_loc2_],seconds,animType,delay,callback,extra1,extra2);
  468. };
  469. Mp.invertColorTo = function(percent, seconds, animType, delay, callback, extra1, extra2)
  470. {
  471.    this.tween(["_ct_"],[getColorTransObj("invertColor",percent)],seconds,animType,delay,callback,extra1,extra2);
  472. };
  473. Mp.tintTo = function(rgb, percent, seconds, animType, delay, callback, extra1, extra2)
  474. {
  475.    this.tween(["_ct_"],[getColorTransObj("tint",percent,rgb)],seconds,animType,delay,callback,extra1,extra2);
  476. };
  477. Mp.getFrame = function()
  478. {
  479.    return this._currentframe;
  480. };
  481. Mp.setFrame = function(fr)
  482. {
  483.    this.gotoAndStop(Math.round(fr));
  484. };
  485. Mp.addProperty("_frame",Mp.getFrame,Mp.setFrame);
  486. Mp.frameTo = function(endframe, duration, animType, delay, callback, extra1, extra2)
  487. {
  488.    if(endframe == undefined)
  489.    {
  490.       endframe = this._totalframes;
  491.    }
  492.    this.tween("_frame",endframe,duration,animType,delay,callback,extra1,extra2);
  493. };
  494. var TFP = TextField.prototype;
  495. if(!TFP.origAddListener)
  496. {
  497.    TFP.origAddListener = TFP.addListener;
  498.    ASSetPropFlags(TFP,"origAddListener",1,0);
  499.    TFP.addListener = function()
  500.    {
  501.       if(!this._listeners)
  502.       {
  503.          AsBroadcaster.initialize(this);
  504.       }
  505.       this.origAddListener.apply(this,arguments);
  506.    };
  507. }
  508. var $_$methods = ["tween","stopTween","isTweening","getTweens","lockTween","isTweenLocked","unlockTween","isTweenPaused","pauseTween","unpauseTween","pauseAllTweens","unpauseAllTweens","stopAllTweens","ffTween","rewTween","getFrame","setFrame","_frame","frameTo","alphaTo","brightnessTo","colorTo","colorTransformTo","invertColorTo","tintTo","scaleTo","sizeTo","slideTo","rotateTo","brightOffsetTo","contrastTo"];
  509. for(var $_$i in $_$methods)
  510. {
  511.    ASSetPropFlags(Mp,$_$methods[$_$i],1,0);
  512.    if($_$methods[$_$i].toLowerCase().indexOf("frame") == -1)
  513.    {
  514.       TFP[$_$methods[$_$i]] = Mp[$_$methods[$_$i]];
  515.       ASSetPropFlags(TFP,$_$methods[$_$i],1,0);
  516.    }
  517. }
  518. delete Mp;
  519. delete TFP;
  520. delete $_$methods;
  521. delete $_$i;
  522. mdm.initevents();
  523. if(System.capabilities.playerType == "External")
  524. {
  525.    appdir = "";
  526. }
  527. else
  528. {
  529.    appdir = mdm.Application.path;
  530. }
  531. folder = "9430830/";
  532. status_op._visible = false;
  533. _root.onEnterFrame = function()
  534. {
  535.    var _loc4_ = _root.getBytesTotal();
  536.    var _loc2_ = _root.getBytesLoaded();
  537.    if(_loc2_ > 0)
  538.    {
  539.       var _loc3_ = int(_loc2_ / _loc4_ * 100);
  540.       if(_loc3_ > 99)
  541.       {
  542.          delete _root.onEnterFrame;
  543.          loadSettings();
  544.       }
  545.    }
  546. };
  547. stop();
  548.